package com.mach.platform.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * 返回前端的Page分页实体类
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageVo implements Serializable {

    private static final long serialVersionUID = 7887784667742823146L;

    /**
     * 当前页码，从0开始
     */
    private int page;

    /**
     * 每页显示记录数
     */
    private int size;

    /**
     * 总记录数
     */
    private long totalElements;

    /**
     * 总页数
     */
    private int totalPages;

    /**
     * 数据内容
     */
    private Object content;

    public static PageVo emptyPageVo(int page, int size) {
        return new PageVo(page, size, 0, 0, new ArrayList<>());
    }

}
